//
//  MusicCell.m
//  DownLoadByNSURLSession
//
//  Created by @Zs on 16/4/18.
//  Copyright © 2016年 @Zs. All rights reserved.
//

#import "MusicCell.h"
#import <AVFoundation/AVFoundation.h>
#import "STKAudioPlayer.h"

@interface MusicCell ()

@property (weak, nonatomic) IBOutlet UILabel *nameLabel;

@property (nonatomic , strong) NSString *musicPath;


@property (nonatomic,strong) STKAudioPlayer *audioPlayer;//播放器

@end


@implementation MusicCell



- (void)awakeFromNib {
    // Initialization code
    
}





- (IBAction)playMusic:(id)sender {
    
//    NSLog(@"播放路径%@",_musicPath);
    
    NSURL *pathUrl = [NSURL fileURLWithPath:_musicPath];
    
    NSLog(@"play Url :%@",pathUrl);
    
    _audioPlayer = [[STKAudioPlayer alloc] init];
    [_audioPlayer playURL:pathUrl];
}


- (void)cellInoWithDictionary:(NSDictionary *)dict
{
    _nameLabel.text = dict[@"name"];
    
    _musicPath = dict[@"musicPath"];
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
